<!DOCTYPE html>
<html class="index_body">
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=10">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <title></title>
    <link rel="stylesheet" href="/Public/mui/computer/css/bootstrap.css"/>
    <link rel="stylesheet" href="/Public/mui/computer/css/index.css"/>
    <link rel="stylesheet" href="/Public/mui/css/page.css"/>
    <link rel="stylesheet"  href="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.css">
</head>
<body class="index_body">
<include file="Lay:heder" />
<div id="section" style="padding-top: 20px">
    <table class="table table-hover table-striped all_table">
        <thead class="all_thead">
         <tr>
           <th>订单号</th>
           <th>姓名</th>
           <th>退款金额</th>
           <th>定金</th>
           <th>状态</th>
           <th>操作</th>
         </tr>
        </thead>
        <tbody class="tables_order table_hover">
        <foreach name="orders" item="v" >
         <tr orderid="{{$v['id']}}">
             <td>{{$v['orderid']}}</td>
             <td>{{$v['nickname']}}</td>
             <td>{{$v['money']}}</td>
             <td>{{$v['depositnum']}}</td>
             <td>{{$v['apply_refund']}}</td>
             <td><a href="#}" onclick="setApplyRefund({{$v['orderid']}}, -1)">驳回</a></td>
             <td><a href="#"  onclick="setApplyRefund({{$v['orderid']}}, 4)">通过</a></td>
         </tr>
         </foreach>
        </tbody>
    </table>
    <include file="News:news" />
     <nav aria-label="Page navigation" class="pagin">
        <div class ="black2"></div>
     </nav>
</div>
<script src="/Public/mui/computer/js/jquery-1.11.3.js"></script>
<script src="/Public/mui/computer/js/functions.js"></script>
<script src="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript" src="/Public/mui/computer/js/order.js?v=2"></script>
<script src="/Public/mui/computer/js/back.js"></script>
<script type="text/javascript">
    newsdingdan();
    function newsdingdan(){
        $(parent.frames["leftFrame"].document).find(".click_control").removeClass("active_p ");
        $(parent.frames["leftFrame"].document).find("#hisinformation").prev().addClass("active_p");
        $(parent.frames["leftFrame"].document).find(".menuson ").addClass("hidden_l").removeClass("show_l");
        $(parent.frames["leftFrame"].document).find("#examinelist").addClass("active");
        $(parent.frames["leftFrame"].document).find("#examinelist").siblings().removeClass("active");
        $(parent.frames["leftFrame"].document).find("#hisinformation").addClass("show_l").removeClass("hidden_l");
    }
    
    function setApplyRefund(orderid, status)
    {
        if (status == -1) {
            var title = "确定驳回退款申请吗？";
            var text = "驳回后将立即生效并跳转到列表页面。";
            var result = { 
                title: "驳回备注", 
                text: "为什么驳回？",
                type: "input", 
                confirmButtonText: "好了",
                cancelButtonText: "取消",
                showCancelButton: true, 
                closeOnConfirm: false, 
                animation: "slide-from-top", 
                inputPlaceholder: "请简单说明为什么驳回。"
            }
        } else if (status == 4) {
            var title = "确定通过退款申请吗？";
            var text = "通过后将立即生效并跳转到列表页面。";
            var result = { 
                title: "通过备注", 
                text: "为什么通过？",
                type: "input", 
                confirmButtonText: "好了",
                cancelButtonText: "取消",
                showCancelButton: true, 
                closeOnConfirm: false, 
                animation: "slide-from-top", 
                inputPlaceholder: "请简单说明为什么通过。"
            }
        }
        swal({title: title,text: text, type: "warning",showCancelButton: true, confirmButtonColor: "#DD6B55",confirmButtonText: "确定",cancelButtonText: "取消", closeOnConfirm: false
        },
        function(){
            if(orderid == ""){
                sweetAlert('','对不起,操作有误,请重新刷新页面','error');return false;
            }
            var remark = $('input[name="remark"]').val();
            swal(result,
                function(inputValue){ 
                    if(inputValue != "" && inputValue){
                        $('input[name="remark"]').val(inputValue);
                        var tel = window.localStorage.getItem('UserPhone');
                        var data = {orderid: orderid, status: status, remark: inputValue, tel: tel};
                        get('setApplyRefund', data, 
                        function(res){
                            mui.toast(res.msg);
                            if (res.status == 'success') {
                                setTimeout(function(){
                                    window.location.href = '/admin/Order/getApplyRefund?tel='+tel;
                                }, 1000);
                            } 
                        });
                    }
            });
            return false;
    
        });
    }

</script>
</body>
</html>